package com.st.shopadmin.controller;

import com.st.shopadmin.annotation.LoginAccess;
import com.st.shopadmin.common.ServerResponse;
import com.st.shopadmin.pojo.BuyerUserInfo;
import com.st.shopadmin.pojo.ShopUserPlat;
import com.st.shopadmin.service.BuyerService;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/manage/buyer/")
public class BuyerManagerController {
    @Autowired
    private BuyerService buyerService;

    @RequestMapping("/to_list.do")
    public String table()  {
        return "buyer/list";
    }

    /**
     * class_name: BuyerManagerController
     * package: com.st.shopadmin.controller
     * describe: 微客管理列表（前端分页）
     * author: duhongpeng
     * date: 2018/10/30
     * time: 13:35
     **/
    @RequestMapping("lists.do")
    @ResponseBody
    @LoginAccess
    public ServerResponse getBuyerLists(HttpServletRequest httpServletRequest, @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,@RequestParam(value = "pageSize",defaultValue = "10") int pageSize){
        ServerResponse<List> serverResponse = buyerService.getBuyerLists(pageNum,pageSize);
        serverResponse.setTotal(serverResponse.getData().size());
        return serverResponse;
    }

    /**
     * class_name: BuyerManagerController
     * package: com.st.shopadmin.controller
     * describe: 微客管理列表（后端分页）
     * author: duhongpeng
     * date: 2018/10/30
     * time: 13:35
     **/
    @RequestMapping("page.do")
    @ResponseBody
    public ServerResponse getBuyerPage(HttpServletRequest httpServletRequest, @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,@RequestParam(value = "pageSize",defaultValue = "10") int pageSize){
        return buyerService.getBuyerPage(pageNum,pageSize);
    }

    @RequestMapping("searchLists.do")
    @ResponseBody
    public ServerResponse searchLists(HttpServletRequest httpServletRequest, BuyerUserInfo shop,@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,@RequestParam(value = "pageSize",defaultValue = "10") int pageSize){
        ServerResponse<List> serverResponse = buyerService.searchLists(shop,pageNum,pageSize);
        serverResponse.setTotal(serverResponse.getData().size());
        return serverResponse;
    }

    /**
     * class_name: BuyerManagerController
     * package: com.st.shopadmin.controller
     * describe: 微客身份审核详情
     * author: duhongpeng
     * date: 2018/10/30
     * time: 13:35
     **/
    @RequestMapping("detail.do")
    @ResponseBody
    public ServerResponse getBuyerDetail(HttpServletRequest httpServletRequest, Long buyerId){
        return  buyerService.getBuyerDetail(buyerId);
    }
    /**
     * class_name: BuyerManagerController
     * package: com.st.shopadmin.controller
     * describe: 微客身份审核操作
     * author: duhongpeng
     * date: 2018/10/30
     * time: 13:35
     **/
    @RequestMapping("updateIdStatus.do")
    @ResponseBody
    public ServerResponse updateBuyerIdStatus(HttpServletRequest httpServletRequest, Long buyerId,Integer idStatus,String idNopassReason){
        return  buyerService.updateBuyerStatus(buyerId,idStatus,idNopassReason);
    }

    /**
     * class_name: BuyerManagerController
     * package: com.st.shopadmin.controller
     * describe: 微客淘宝审核详情
     * author: duhongpeng
     * date: 2018/10/30
     * time: 13:35
     **/
    @RequestMapping("taoBaoCheckDetail.do")
    @ResponseBody
    public ServerResponse taoBaoCheckDetail(HttpServletRequest httpServletRequest, Long buyerId){
        return  buyerService.taoBaoCheckDetail(buyerId);
    }

    /**
     * class_name: BuyerManagerController
     * package: com.st.shopadmin.controller
     * describe: 微客淘宝审核操作
     * author: duhongpeng
     * date: 2018/10/30
     * time: 13:35
     **/
    @RequestMapping("updateTaoBaoStatus.do")
    @ResponseBody
    public ServerResponse updateTaoBaoStatus(HttpServletRequest httpServletRequest, Long buyerId,Integer taoBaoStatus,String taoBaoNopassReason){
        return  buyerService.updateTaoBaoStatus(buyerId,taoBaoStatus,taoBaoNopassReason);
    }

    /**
     * class_name: BuyerManagerController
     * package: com.st.shopadmin.controller
     * describe: 微客停用操作
     * author: duhongpeng
     * date: 2018/10/30
     * time: 13:35
     **/
    @RequestMapping("stopStatus.do")
    @ResponseBody
    public ServerResponse stopStatus(HttpServletRequest httpServletRequest, Long buyerId,String stopReason){
        return  buyerService.stopStatus(buyerId,stopReason);
    }

}
